/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package beans;

import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;

/**
 *
 * @author machine
 */
@Stateless
public class SeriesFacade extends AbstractFacade<Series> implements SeriesFacadeLocal {
    @PersistenceContext(unitName = "videosJEE-ejbPU")
    private EntityManager em;

    @Override
    protected EntityManager getEntityManager() {
        return em;
    }

    public SeriesFacade() {
        super(Series.class);
    }

    @Override
    public Series consultarSerie(String idserie) {
        Query query = em.createQuery( "SELECT c FROM Series c WHERE c.idseries = " + idserie + " " );
        
        return (Series) query.getSingleResult();
    }
    
}
